﻿using System;
using System.CodeDom.Compiler;

namespace FBGraph.ClientGenerator.CodeGen
{
    public class ChainedConstructor : CodeGenObject
    {
        public ChainedConstructor(String chainType, params String[] parameters)
        {
            this.ChainType = chainType;
            this.Parameters = new CodeGenObjectList<String>(", ", parameters);
        }

        public String ChainType { get; set; }
        public CodeGenObjectList<String> Parameters { get; set; }

        public override void Write(CodeGenWriter writer)
        {
            writer.WriteLine();
            using (writer.Indent())
            {
                writer.Write(": {0}(", this.ChainType);
                writer.Write(this.Parameters);
                writer.Write(")");
            }
        }
    }
}